use "C:\Users\data.dta" 
drop if year<1993|year>2018
egen id = group( ccode )
sort id year
xtset id year
gen incorruptibility=100*wbgi_cce
gen women=100* vdem_gender
gen hdi=100* undp_hdi

global contral = "wdi_gdpcapgr wdi_fdiin wdi_trade wdi_internet wdi_popurb wdi_inflation"
sum hdi wdi_povgap320  women wdi_gdpcapgr wdi_fdiin  wdi_trade wdi_internet wdi_popurb wdi_inflation incorruptibility wdi_unempfne wdi_expedu


**********fe model***********************
xtreg hdi women,fe
est store fe3
xtreg hdi women $contral, fe
est store fe
xtreg hdi women $contral, re
est store re
xtreg hdi L.women $contral, fe
est store fe1
xtreg hdi women $contral  i.year, fe
est store fe2
xtivreg2  hdi  (women=L.women)  $contral, fe
est store f1
esttab fe3 fe re fe1 fe2 f1, cells(b(star fmt(4)) se(par fmt(2))) 
legend label varlabels(_cons constant) 
stats(N r2, fmt(0 3) label(N R-squared ))    
hausman fe re,sigmamore
xtivreg2  hdi  (women=L.women)  $contral, fe
estat firststaga,all forcenonrobust
estat overid

**********Robustness check***************
**********check 1：Add more control variables********
xtreg hdi women $contral wdi_chexppgdp, fe
est store r1
**********check 2：Replace dependent variable********
xtreg wdi_povgap320 women $contral , fe
ewinsor hdi, gen(hdi_winsor) p(0.05)
est store r2
**********check 3：Replace independent variable********
xtreg hdi wdi_wip $contral , fe
est store r3
esttab r1 r2 r3 , cells(b(star fmt(4)) se(par fmt(2))) 

**********Heterogeneity analysis*******************
recode wdi_gnicappppcur (0/12375=0) (12376/2000000=1),gen(jingji)
xtreg hdi women $contral if jingji==0,fe
est store H1
xtreg hdi women $contral if jingji==1,fe
est store H2
xtreg hdi women $contral ,fe
est store H3
esttab H1 H2 H3, cells(b(star fmt(4)) se(par fmt(2))) 

**********Mechanism analysis***********************
xtreg incorruptibility women ,fe
est store M1
xtreg incorruptibility women $contral , fe
est store M2
xtreg wdi_unempfne women ,fe
est store M3
xtreg wdi_unempfne women $contral , fe
est store M4
xtreg wdi_expedu women , fe
est store M5
xtreg wdi_expedu women $contral , fe
est store M6
esttab M1 M2 M3 M4 M5 M6, cells(b(star fmt(4)) se(par fmt(2))) 
